package com.vint.mi;

/**
 * Copyright (C) 2017, Xiaomi Inc. All rights reserved.
 * Created by vint @ 2017/10/24.
 * in leetcode
 */
public class Mi48 {
    public static String solution(String line){
        String[] src = line.split(",");
        int sum = 0;
        for(int i = 0 ; i < src.length; i++){
            for(int j = i + 1; j < src.length; j++){
                if(Integer.parseInt(src[i])+Integer.parseInt(src[j])==10 || Integer.parseInt(src[i]) - Integer.parseInt(src[j]) ==10 || Integer.parseInt(src[i]) - Integer.parseInt(src[j]) == -10) {
                    sum ++;
                }
            }
        }
        return Integer.toString(sum);
    }
    public static void main(String[] args) {
        String ex1 = "4,13,5,6,35,85,3";
        String ex2 = "13,3,6,8,12,4,45,56,66,16";
        String ex3 = "6,4,16";
        System.out.println(solution(ex1));
        System.out.println(solution(ex2));
        System.out.println(solution(ex3));

    }
}
